package com.atguigu.springcloud.controller;

import com.google.common.collect.Queues;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author fys2000
 * @date 2020/7/22 10:45
 * @since 最早从哪个版本开始的，如v1.0.1
 */
@RestController
@EnableBinding(Sink.class)

public class ReceiveController {
    @Value("${server.port}")
    private String serverPort;

    @StreamListener(Sink.INPUT)
    public void input(Message<String> message) {
        System.out.println("消费者" + serverPort + "接收到消息：" + message.getPayload());
    }

}
